
#ifndef _TSOC_COLOR_
#define _TSOC_COLOR_

#include <stdint.h>



namespace com
{
	namespace toxiclabs
	{
		namespace tsoc
		{
			
			class Color
			{
				public:
					
					union
					{
						struct
						{
							float r;
							float g;
							float b;
							float a;
						};
						float data[4];
					};
				
				/*! 
					Empty constructor
				*/
				Color();
				
				/*!
					packed 32 bits rgba pixel constructor
				*/ 
				Color(uint32_t pixel);
					
				/*!
					RGBA Constructor
				*/
				Color(float r,float g,float b,float a);
					
				/*!
					kelvin color temperature constructor
				*/	
				Color(float k);
				
				/*!
					Sets rgb values
				*/
				void Set(float r,float g,float b,float a);
					
					
				/*!
					Clamp values
				*/
				void Clamp();
				
				/*!
					Averages a color
				*/
				Color Mix(Color & a);
					
				/*!
					Access color members
				*/
				float& operator[] (int n);

				/*!
					Gets a 32-bit rgba pixel
				*/
				uint32_t Pixel();
			};
			
			/*!
				Color addition
			*/
			Color operator+(Color a,Color &b);
			
			/*!
				Color substraction
			*/
			Color operator-(Color a,Color &b);
			
			/*!
				Mult a color by a scalar value
			*/
			Color operator*(Color a,float factor);
			
			/*!
				Mult two colors
			*/
			Color operator*(Color a,Color &b);
			
			
		}
	}
}

#endif
